package jdbc.day1.demo4_批处理;

import jdbc.Util;

import java.sql.Connection;
import java.sql.PreparedStatement;

public class A {
    public static void main(String[] args)throws Exception {
        Connection con= Util.getConnection();
        PreparedStatement st=con.prepareStatement("insert into stu (c_id,sname,score) values(?,?,?)");
        st.setInt(1,1);
        st.setString(2,"abc1");
        st.setDouble(3,89);
        st.addBatch();
        st.setInt(1,2);
        st.setString(2,"abc2");
        st.setDouble(3,82);
        st.addBatch();

        st.executeBatch();

        Util.close(con,st,null);

    }
}
